package com.zzxy.spring.service.impl;

import com.zzxy.spring.dao.IUserDao;
import com.zzxy.spring.dao.impl.UserDaoImpl;
import com.zzxy.spring.entity.User;
import com.zzxy.spring.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.support.JdbcDaoSupport;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

/**
 * @author aven
 * @description:
 */
@Service("userservice5")
public class UserServiceImpl extends JdbcDaoSupport implements IUserService {
    @Autowired
    private UserDaoImpl dao;

   /* private JdbcTemplate jdbcTemplate;

    public JdbcTemplate getJdbcTemplate() {
        return jdbcTemplate;
    }

    public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }*/
    /*public UserDaoImpl getDao() {
        return dao;
    }

    public void setDao(UserDaoImpl dao) {
        this.dao = dao;
    }*/

    @Override
    public void addUser() {
        System.out.println("--add user success--");
    }

    public void insert(User user) {
        dao.insert(user);
    }

    @Override
    public void deleteUser() {
        System.out.println("delete user ...");
    }

    @Override
    public int test() {
//        int i = 3 / 0;
        return 1;
    }

    @Override
    public void insert() {
        this.getJdbcTemplate().update("insert into user values (null,?,?)", "lisi2", "88889");
    }
}
